import javax.servlet.http.*;
import java.sql.*;
import java.io.*;

public class CompanyCollegeServlet extends HttpServlet
{
  
  public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException
  {

     try
       {
  String  college_name=request.getParameter("college");

         response.setContentType("text/html");
         PrintWriter out=response.getWriter();


        Class.forName("oracle.jdbc.driver.OracleDriver");

         Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","pac","mca"); 

         Statement stmt=con.createStatement();
         
             ResultSet rs = stmt.executeQuery("SELECT college_name,university,college_code from college_register WHERE college_name='"+college_name+"'");

              college_name="";
             String university="";
             String college_code="";		
         if(rs.next())

         {
               college_name=rs.getString(1);
	  university=rs.getString(2);
	  college_code=rs.getString(3);
	   }
            
         
        out.println("<html>");
      out.println("<body background=\"t5.jpg\">"); 
       out.println("<br><h1><center> <font color=\"white\"> "+college_name+" </font> </h1> ");

	

     out.println("<table cellspacing='3'>");

        out.println("<tr>");
              out.println(" <td> <b> <font color=\"black\"> Id  </font> </b></td>");
              out.println("<td> <b> <font color=\"white\"> :"+college_name+" </font> </b></td>");
        out.println("</tr>");

        out.println("<tr>");
              out.println(" <td> <b> <font color=\"black\">university </font> </b></td>");
              out.println("<td> <b> <font color=\"white\"> :"+university+" </font> </b></td>");
        out.println("</tr>");

         out.println("<tr>");
              out.println(" <td> <b> <font color=\"black\">university </font> </b></td>");
              out.println("<td> <b> <font color=\"white\"> :"+college_code+" </font> </b></td>");
        out.println("</tr>");

        out.println(" </table> </center>"); 
       

     
     
     out.println("</body>");

     out.println("</html>");   
    
 }
         
     
 
    catch(Exception e)
       {
      
         response.sendError(505,e.getMessage());
         e.printStackTrace();       
}   

  }

}  

 